package com.vim.modules.web.api;

import com.vim.common.annotation.ParentModuleInfo;
import com.vim.common.utils.WeixinUtils;
import com.vim.modules.web.model.WeixinUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@ParentModuleInfo(moduleCode = "weixin", moduleName = "微信平台")
@Api(value = "用户信息", description = "微信用户信息、用户列表")
@RestController("/api/weixin")
public class WeixinApiController {

    /**
     * 获取用户信息
     */
    @ApiOperation(value = "微信用户信息", notes="{\"sex\":\"1\",\"nickname\":\"海绵宝宝\",\"headimgurl\":\"http://thirdwx.qlogo.cn/mmopen/ajNVdqHZLLB2WfvXsal2mIkib2rjj1jRB9NOGZn8PlG9AQx5hKXz1tvQrMHbMYgUlzxkk1TYO3PialPTWodRzUSQ/132\"}", httpMethod="GET")
    @ApiImplicitParams({@ApiImplicitParam(name = "openid", value = "微信用户唯一标识", required = true)})
    @RequestMapping("/userInfo")
    public WeixinUser userInfo(@RequestParam(value = "openid") String openid){
        return WeixinUtils.userInfo(openid);
    }
}
